<template >    
    <div class="side-menu-comp">
        <MenuTree :menu="menuData"></MenuTree>
    </div>
</template>

<script>
import MenuTree from '../../components/sideMenu/MenuTree'
import menuData from './menuData.js'

export default {
    components: {
        MenuTree
    },
    data(){
        return {
            menuData: [],
            defaultProps:{
                children: 'children',
                label: 'label'
            }
            
        }
    },
    mounted(){
        const menuDataimport = menuData.concat([])
        this.initMenuData(menuDataimport, 1)
        this.menuData = menuDataimport
    },
    methods:{
        handleNodeClick(data) {
            console.log(data);
        },
        initMenuData(l, paramLevel){            
            l.forEach(menu => {
                if(!menu.level){
                    menu.level = paramLevel
                }
                if(menu.children){
                    menu.expand = true
                    this.initMenuData(menu.children, menu.level+1)
                }          
            });
        },

    }
}
</script>

<style lang="scss">
.side-menu-comp{
    
}
</style>

<style lang="scss" scoped>
.side-menu-comp{
    
}
</style>
